package com.jctrip.hotel.source.client;

import java.util.List;

import com.jctrip.hotel.source.model.hworld.req.*;
import com.jctrip.hotel.source.model.hworld.resp.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author henry
 * @Date 2023/5/24 21:38
 * @Description
 */
@FeignClient(name = "HworldClient", url = "${feign.url.hworld}")
@RequestMapping(headers = {"accept=application/json", "Content-Type=application/json;charset=UTF-8","Accept-Encoding=gzip, deflate"})
public interface HworldClient {

    /**
     * 获取酒店列表
     */
    @PostMapping("/hotel/getHotelList")
    HworldResult<List<HworldHotelInfo>> getHotelList(
            @RequestHeader("Authorization") String token,
            @RequestBody BaseReq req
    );

    /**
     * 获取酒店详情
     * 包括了酒店图片 和房型
     */
    @PostMapping("/hotel/getHotelComplexList")
    HworldResult<List<HworldHotelDetail>> getHotelComplexList(
            @RequestHeader("Authorization") String token,
            @RequestBody HotelComplexListReq req
    );

    /**
     * 获取活动价规则
     */
    @PostMapping("/hotel/getActivityRuleList")
    HworldResult<List<HworldActivityRuleListResult>> getActivityRuleList(
            @RequestHeader("Authorization") String token,
            @RequestBody BaseReq req
    );

    /**
     * tmc 获取房量房价
     */
    @PostMapping("/hotel/getTMCRoomPrice")
    HworldResult<List<TMCRoomPriceResult>> getTMCRoomPrice(
            @RequestHeader("Authorization") String token,
            @RequestBody HworldTMCRoomPriceReq req
    );

    /**
     * 下单前验证是否可定指定房型接口
     */
    @PostMapping("/hotel/checkAvailability")
    HworldResult<HworldCheckAvailabilityDTO> checkAvailability(
            @RequestHeader("Authorization") String token,
            @RequestBody HworldCheckAvailabilityReq req
    );

    /**
     * 下单 resopnse = 500或者超时，需要重试
     * 具体需要看接口文档
     */
    @PostMapping("/order/add")
    HworldResult<HworldOrderInfo> addOrder(
            @RequestHeader("Authorization") String token,
            @RequestBody HworldAddOrderReq req
    );

    /**
     * 查询订单
     */
    @PostMapping("/order/queryByRequestNo")
    HworldResult<HworldOrderInfo> queryOrderByRequestNo(
            @RequestHeader("Authorization") String token,
            @RequestBody QueryOrderReq req
    );

    /**
     * 取消订单
     */
    @PostMapping("/order/cancel")
    HworldResult<Boolean> cancelOrder(
            @RequestHeader("Authorization") String token,
            @RequestBody CancelOrderReq req
    );

    /**
     * 获取卡等级信息
     */
    @PostMapping("/member/getCardInfo")
    HworldResult<List<HworldCardInfo>> getCardInfo(
            @RequestHeader("Authorization") String token,
            @RequestBody HworldGetCardInfoReq req
    );
}
